home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
mail
/
thor201.lha
/
THOR_2.0
/
thor.lha
/
rexx
/
UUEncode.fse
< prev
next >
Wrap
Text File
|
1995-05-15
|
3KB
|
114 lines
/* UUEncode.fse by Troels Walsted Hansen
** $VER: UUEncode.fse v1.00 (01.11.94)
**
** An ARexx script that uuencodes a file and imports it into
** the FSE you are currently using. Unless the file is already
** archived this script will optionally do it for you (using LhA).
**
** Utilises LhA by Stefan Boberg and either of the following:
** · UUFast v1.25 by Jørn Halonen
** · uuIn v1.03 by Nicolas Dade
** · UUxT v3.0 by Asher Feldman
*/
/* some user variables. edit to your hearts content */
tmpdir = "T:" /* Work dir for the encoding */
uuencoder = "uuin" /* may be: uuin, uufast or uuxt */
/* needs FSE, THOR and bbsread.library functions */
options results
if(substr(address(),1,8) ~= "THOR_FSE") then
do
say "This script should only be started from inside the FSE."
exit 20
end
else fseport = address()
p = address() || ' ' || show('P',,)
thorport = pos('THOR.',p)
if thorport > 0 then thorport = word(substr(p,thorport),1)
else
do
say 'No THOR port found!'
exit 10
end
if ~show('p', 'BBSREAD') then
do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
end
/* get filename */
address(bbsread)
GETGLOBALDATA STEM GLOBALDATA
address(thorport)
THORTOFRONT
REQUESTFILE TITLE '"Select file to encode:"' ID '"'GLOBALDATA.UPLOADPATH'"' FP PAT '"#?"'
if(rc ~= 0) then exit
filetoencode = result
lastchar = right(filetoencode,1)
if(lastchar = "/" | lastchar = ":" | filetoencode = "") then
do
REQUESTNOTIFY TEXT '"No file selected!"' BT '"_Ok"'
call CleanUp()
end
posi = lastpos("/",FileToEncode)
if(posi = 0) then posi = lastpos(":",FileToEncode)
WithoutPath = substr(FileToEncode,posi+1)
/* if file isn't LhA'ed -- do it ourselves */
extension = upper(substr(FileToEncode, lastpos(".",FileToEncode)+1))
if~(extension = "LHA" | extension = "LZH") then
do
REQUESTNOTIFY TEXT '"Do you want to LhA the file?"' BT '"_Yes|_No"'
if(result) then
do
address command "LhA >nil: -y -q a "||'"'tmpdir||WithoutPath'"'||" "||'"'FileToEncode'"'
if(rc ~= 0) then REQUESTNOTIFY TEXT '"LhA''ing did not succeed."' BT '"_Ok"'
else FileToEncode = tmpdir||WithoutPath||".lha"
end
end
select
when(uuencoder = 'uufast') then cmd = "UUFast >nil: " || '"' || filetoencode || '"' || " TO " || tmpdir || "Message.uu E"
when(uuencoder = 'uuin') then cmd = "uuIn >nil: INFILE=" || '"' || filetoencode || '"' || " OUTFILE=" || tmpdir || "Message.uu"
when(uuencoder = 'uuxt') then cmd = 'UUxT >nil: a ' || tmpdir || 'Message.uu ' || '"'filetoencode'"'
otherwise
do
REQUESTNOTIFY TEXT '"UUEncoder not configured correctly."' BT '"_Ok"'
call CleanUp()
end
end
address command cmd
if ~exists(tmpdir"Message.uu") then
do
REQUESTNOTIFY TEXT '"Something went wrong during uuencoding."' BT '"_Ok"'
call CleanUp()
end
address(fseport)
INCLUDEFILE tmpdir"Message.uu"
/* cleanup and exit */
CleanUp:
if(exists(tmpdir || WithoutPath || ".lha")) then address command 'delete >nil: ' || '"' || tmpdir || WithoutPath || '.lha' || '"'
if(exists(tmpdir || "Message.uu")) then address command 'delete >nil: ' || tmpdir || 'Message.uu'
exit
return